package com.kimho.cost.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kimho.core.PageInfo;
import com.kimho.cost.domain.Cost;
import com.kimho.cost.persistence.CostMapper;
import com.kimho.inhouse.domain.Inhouse;
@Service
public class CostService {

	@Autowired
	private CostMapper costMapper;
	/**
	 * 获取物流信息
	 * @return
	 */
	public Long getTotal() {
		return costMapper.getTotal();
	}
	public List<Cost> getCostList(PageInfo pi) {
		return costMapper.getCostList(pi);
	}
	public List<Cost> getdebtList(PageInfo pi) {
		return costMapper.getdebtList(pi);
	}
	public List<Cost> getInstListo(PageInfo pi) {
		return costMapper.getInstListo(pi);
	}
	
	public List<Cost> sendbill_list(Map<String, Object> map){
		return costMapper.sendbill_list(map);
	}
	
	public List<Cost> donebill_list(PageInfo pi){
		return costMapper.donebill_list(pi);
	}
	public void bill_insert(Map<String, Object> map){
		 costMapper.bill_insert(map);
		 return;
	}
	
	public List<Cost>getInstList(PageInfo pi){
		return costMapper.getInstList(pi);
	}
	
	
	public void updateCost(Cost Cost,Map<String,Object> param) {
		//新增物流
		costMapper.updateCost(Cost);
		
	}
	public void updateInst(Cost cost,Map<String,Object> param){
		costMapper.updateInst(cost);
	}
	public void insertInst(Cost cost,Map<String,Object>param){
		costMapper.insertInst(cost);
	}
	
	
	public void donebillok(Map<String,Object>param){
		costMapper.donebillok(param);
		costMapper.donebillok_cost(param);
	}
	public void sendbill_done(String [] ids , String bill_id){
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("bill_id", bill_id);
		for (int i = 0; i < ids.length; i++) {
			map.put("cost_id", ids[i]);
			this.costMapper.sendbill_done(map);
			this.costMapper.insertbill_done(map);
		}
	}
	
	
}
